*******************************************	   
************* TABLE A11 Oil Shock Placebo
*******************************************	   

clear all
clear matrix
set more off

* Data ready for analysis:
use "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/panel_excombatientes.dta", clear 

sort wartimenetwork
by wartimenetwork: egen mean_oil_production=mean(pipelen2000)
gen mean_oil_shock=mean_oil_production*log_oil_price

* Standarize 
sum oil_shock
generate oil_shock_r = (oil_shock-r(mean))/r(sd)

sum mean_oil_shock
generate mean_oil_shock_r = (mean_oil_shock-r(mean))/r(sd)

eststo clear
set more off

reghdfe diffcaptures_f oil_shock_r mean_oil_shock_r, absorb(wartimenetwork year origmun) vce(cluster wartimenetwork)
estadd local ALLFE = "$\checkmark$"
summ diffcaptures_f if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

reghdfe diffcaptures oil_shock_r mean_oil_shock_r, absorb(wartimenetwork year origmun) vce(cluster wartimenetwork)
estadd local ALLFE = "$\checkmark$"
summ diffcaptures if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA11_panelA.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   stats(meanDep SDDep N ALLFE TT MT BC CO, fmt(%12.4fc %12.4fc  %12.0fc %12.0fc %12.0fc %12.0fc  %12.0fc ) ///
	   label("\small Mean of Outcome" "\small S.D of Outcome" "\small Observations" "\small Municipality, Year, and Group FE" "\small Time Trends" "\small Region $\times$ Year"  ///
	   "\small Municipality Characteristics TT" "\small Individual Covariates" )) ///
	   keep(oil_shock_r mean_oil_shock_r) ///
	   varlabels(oil_shock_r "Oil Shock" mean_oil_shock_r "Average Oil Shock" ) ///
	   ti("Placebo Oil Shock") ///	  
	   replace 
	  
eststo clear
set more off

reghdfe diffcaptures_f oil_shock_r mean_oil_shock_r, absorb(wartimenetwork year origmun) vce(cluster wartimenetwork)
nlcom _b[mean_oil_shock_r]/(_b[oil_shock_r] + _b[mean_oil_shock_r]), post
eststo

reghdfe diffcaptures oil_shock_r mean_oil_shock_r, absorb(wartimenetwork year origmun) vce(cluster wartimenetwork)
nlcom _b[mean_oil_shock_r]/(_b[oil_shock_r] + _b[mean_oil_shock_r]), post
eststo

esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA11_panelB.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   stats(meanDep N, fmt(%12.4fc %12.0fc)) ///
	   keep(_nl_1) ///
	   varlabels( _nl_1 "Peer Effect") ///
	   replace	   
